﻿<%@ Page Language="C#" CodeBehind="Users.aspx.cs" Inherits="bGallery.Web.Admin.Users" MasterPageFile="~/Web/Admin/AdminTemplate.Master" %>

<asp:Content id="body" contentPlaceholderId="body" runat="server">
	<h2><%= GetMessage("mainHeader") %></h2>
	
	<h3><%= GetMessage("userEditHeader") %></h3>
	<asp:Table runat="server">
		<asp:TableRow>
			<asp:TableHeaderCell class="leftHeader"><asp:Label runat="server" ID="lblName" /></asp:TableHeaderCell>
			<asp:TableCell><asp:TextBox runat="server" ID="tbName" /></asp:TableCell>
		</asp:TableRow>
		<asp:TableRow>
			<asp:TableHeaderCell class="leftHeader"><asp:Label runat="server" ID="lblSurname" /></asp:TableHeaderCell>
			<asp:TableCell><asp:TextBox runat="server" ID="tbSurname" /></asp:TableCell>
		</asp:TableRow>
		<asp:TableRow>
			<asp:TableHeaderCell class="leftHeader"><asp:Label runat="server" ID="lblUsername" /></asp:TableHeaderCell>
			<asp:TableCell><asp:TextBox runat="server" ID="tbUsername" /></asp:TableCell>
		</asp:TableRow>
		<asp:TableRow>
			<asp:TableHeaderCell class="leftHeader"><asp:Label runat="server" ID="lblEmail" /></asp:TableHeaderCell>
			<asp:TableCell><asp:TextBox runat="server" ID="tbEmail" /></asp:TableCell>
		</asp:TableRow>
		<asp:TableRow>
			<asp:TableHeaderCell class="leftHeader"><asp:Label runat="server" ID="lblPassword" /></asp:TableHeaderCell>
			<asp:TableCell><asp:TextBox runat="server" ID="tbPassword" /></asp:TableCell>
		</asp:TableRow>
		<asp:TableRow>
			<asp:TableCell ColumnSpan="2">
				<asp:Button runat="server" ID="btnSave" OnClick="SaveUser" />
				<asp:Button runat="server" ID="btnCancel" OnClick="Cancel" />
			</asp:TableCell>
		</asp:TableRow>
	</asp:Table>
	
	<h3><%= GetMessage("userListHeader") %></h3>
	<asp:GridView 
		runat="server" 
		ID="gvUsers" 
		AllowPaging="true" 
		DataKeyNames="Id" 
		AutoGenerateColumns="false" 
		AllowSorting="true"
		OnPageIndexChanging="PageIndexChanging"
		OnRowDeleting="DeleteUser"
		OnSelectedIndexChanging="EditUser">
		<Columns>
			<asp:TemplateField SortExpression="Username">
				<HeaderTemplate><%= GetMessage("$this.lblUsername.Text") %></HeaderTemplate>
				<ItemTemplate><%# Eval("Username")%></ItemTemplate>
			</asp:TemplateField>
			<asp:TemplateField SortExpression="Name">
				<HeaderTemplate><%= GetMessage("$this.lblName.Text")%></HeaderTemplate>
				<ItemTemplate><%# Eval("Name") %></ItemTemplate>
			</asp:TemplateField>
			<asp:TemplateField SortExpression="Surname">
				<HeaderTemplate><%= GetMessage("$this.lblSurname.Text")%></HeaderTemplate>
				<ItemTemplate><%# Eval("Surname")%></ItemTemplate>
			</asp:TemplateField>
			<asp:TemplateField SortExpression="Email">
				<HeaderTemplate><%= GetMessage("$this.lblEmail.Text")%></HeaderTemplate>
				<ItemTemplate><%# Eval("Email")%></ItemTemplate>
			</asp:TemplateField>
			<asp:TemplateField>
				<ItemTemplate>
					<asp:LinkButton ID="LinkButton1" CommandArgument='<%# Eval("Id") %>' CommandName="Select" runat="server">
						<%= GetMessage("edit") %>
					</asp:LinkButton>
					<asp:LinkButton ID="LinkButton2" CommandArgument='<%# Eval("Id") %>' CommandName="Delete" runat="server">
						<%= GetMessage("delete") %>
					</asp:LinkButton>
				</ItemTemplate>
		   </asp:TemplateField>
   		</Columns>
	</asp:GridView>
	
</asp:Content>